<div class = "full_width">
<h3>Danh sách bài viết</h3>
<p>
<?php
	echo $this->Paginator->counter(array(
	'format' => __('Có tất cả %count% bài viết', true)
	));
?>	
</p>
<table>
	<tr>
		<th>STT</th>
		<th><?php echo $this->Paginator->sort('Tiêu đề','Post.title'); ?></th>
		<th><?php echo $this->Paginator->sort('Người đăng tin','User.username'); ?></th>
		<th><?php echo $this->Paginator->sort('Chuyên mục','Category.name'); ?></th>
		<th><?php echo $this->Paginator->sort('Thời gian','Post.created'); ?></th>
		<th>Thao tác</th>
	</tr>
	<?php 
		$i = 1;
		foreach ($posts as $post): 
	?>
	<tr>
		<td><?php echo $i++; ?></td>
		<td><?php echo $html->link($post['Post']['title'],array('controller' => 'posts', 'action' => 'view', $post['Post']['id'], 'admin' => 0)); ?></td>
		<td><?php echo $post['User']['username']; ?></td>
		<td><?php echo $post['Category']['name']; ?></td>
		<td><?php echo date('j/m/Y', strtotime($post['Post']['created']));?></td>
		<td>
			<?php echo $this->Html->link($html->image('admin/icons/edit.png'), array('action' => 'edit', $post['Post']['id']), array('escape' => false, 'title' => 'Sửa bài viết')); ?>
			<?php echo $this->Html->link($html->image('admin/icons/delete.png'), array('action' => 'delete', $post['Post']['id']), array('escape' => false, 'title' => 'Xóa bài viết'), sprintf(__('Bạn có chắc muốn xóa chuyên mục [%s]?', true), $post['Post']['title'])); ?>
		</td>
	</tr>
	<?php endforeach; ?>
</table>
<p>
<?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page%/%pages%', true)
	));
?>	
</p>

<div class="paging">
	<?php echo $this->Paginator->prev('<< ' . __('Trở lại', true), array(), null, array('class'=>'disabled'));?>
	| 	
	<?php echo $this->Paginator->numbers();?>
	|
	<?php echo $this->Paginator->next(__('Tiếp', true) . ' >>', array(), null, array('class' => 'disabled'));?>
</div>
</div>